#include <stdio.h>

int main()
{
	int a,b;
	char c;
	scanf("%d%d",&a,&b);
	scanf(" %c",&c);
	double ret;
	if(b == 90)
	{
		if(c == 'm')
		{
			ret = a*6.95*0.95;
		}
		else
		{
			ret = a*6.95*0.97;
		}
	}
	else if(b == 93)
	{
		if(c == 'm')
		{
			ret = a*7.44*0.95;
		}
		else
		{
			ret = a*7.44*0.97;
		}
	}
	else
	{
		if(c == 'm')
		{
			ret = a*7.93*0.95;
		}
		else
		{
			ret = a*7.93*0.97;
		}
	}
	printf("%.2lf",ret);
	
	return 0;
}
